/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-12-29 10:38:18
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-05-16 10:47:05
 * @FilePath: /yt-devops/lib/model/device_obj/device_config_model.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:json_annotation/json_annotation.dart';
import 'package:yt_devops/model/device_obj/authority_config_model.dart';
import 'package:yt_devops/utils/enums.dart';

part 'product_config_model.g.dart';

@JsonSerializable()
class ProductConfigModel<T> {
  final String id;
  final DeviceConfigType type;
  final String? name;
  final String? parentId;
  List<T>? children;
  List<AuthorityModelConfig>? authority;
  DeviceModelShowType? showType;

  set setChildren(List<T> value) {
    children = value;
  }

  ProductConfigModel(
      {required this.id,
      required this.type,
      this.name,
      this.parentId,
      this.showType,
      this.children,
      this.authority});

  factory ProductConfigModel.fromJson(Map<String, dynamic> json) =>
      _$ProductConfigModelFromJson(json);

  Map<String, dynamic> toJson() => _$ProductConfigModelToJson(this);
}

enum DeviceConfigType {
  page,
  group,
  tab,
  tabItem,
  service,
  property,
  component,
  propertyGroup,
  defaults,
  pageComponent,
}
